import React from "react";
import {Button, Card, Space, Table, type TableProps} from "antd";
import {User} from "@/vite-env";
import useUserData from "@/hooks/get_user_data.ts";

const columns: TableProps<User>['columns'] = [
    {
        title: '用户名',
        dataIndex: 'username',
        key: 'username',
        render: (text) => <b>{text}</b>
    },
    {
        title: '用户地址',
        dataIndex: 'address',
        key: 'address'
    },
    {
        title: '用户手机号',
        dataIndex: 'phone_number',
        key: 'phone_number',
    },
    {
        title: '邮箱',
        dataIndex: 'email',
        key: 'email'
    },
    {
        title: '操作',
        key: 'action',
        render: () => (
            <Space size="middle">
                <Button type="primary">详情</Button>
                <Button type="primary" danger>注销</Button>
            </Space>
        ),
    },
];
const User_Data: React.FC = () => {

    // 获取商品数据
    const {userData} = useUserData()
    return (
        <Card
            style={{
                width: '100%',
            }}
        >
            <Table sticky={true} columns={columns} dataSource={userData} scroll={{y: 530}}/>
        </Card>
    )
}

export default User_Data